/*package parkshop.pmcourse.utils;

import java.util.HashMap;
import java.util.Map;

public class TwoDimensionTools {


	   // the test data in the test class
	    public static String encode(String data,int width,int height,String format,String absFileName){  
	       
	        Map<EncodeHintType, Object> hints = new HashMap<EncodeHintType, Object>();  
	        hints.put(EncodeHintType.CHARACTER_SET, "utf-8"); 
	        
	        BitMatrix bitMatrix;
	        boolean isSuccess=true;
			try {
				bitMatrix = new MultiFormatWriter().encode(data,  
						BarcodeFormat.QR_CODE, width, height, hints);
				 BufferedImage image= MatrixToImageWriter.toBufferedImage(bitMatrix);   
			     isSuccess=ImageIO.write(image, format, new File(absFileName));
			    	
			} catch (WriterException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
	       return isSuccess?absFileName:null;
	    }  
		
			  
		public static String decode(String filePath) {  
			 BufferedImage image;  
		        try {  
		            image = ImageIO.read(new File(filePath));
		            LuminanceSource source = new BufferedImageLuminanceSource(image);  
		            Binarizer binarizer = new HybridBinarizer(source);  
		            BinaryBitmap binaryBitmap = new BinaryBitmap(binarizer);  
		            Map<DecodeHintType, Object> hints = new HashMap<DecodeHintType, Object>();  
		            hints.put(DecodeHintType.CHARACTER_SET, "utf-8");  
		            Result result = new MultiFormatReader().decode(binaryBitmap, hints);// 对图像进行解码  
		            return result.getText(); 
		            
		        } catch (NotFoundException e) {  
		            e.printStackTrace();  
		        } catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} 
		        return null;
		    }  
}
*/